function Report = RecursiveValidate(Object,Specification,ErrorWhenFail)
if isfield(Specification,'type')
	Types=Specification.type;
	if ~iscell(Types)
		Types={Types};
	end
	ElementClass=missing;
	IsScalar=isscalar(Object);
	for T=1:numel(Types)
		Type=Types{T};
		switch Type
			case 'matfile'
				if isfile(Object)
					ElementClass='matfile';
				elseif ErrorWhenFail
					error('FormatSpecification:TypeException','：类型错误，不是MAT文件');
				else
					Report=false;
					return
				end
			case 'struct'
				if isstruct(Object)
					ElementClass='struct';
				elseif ErrorWhenFail
					error('FormatSpecification:TypeException','：类型错误，不是结构体');
				else
					Report=false;
					return
				end
			case 'table'
				if istable(Object)
					ElementClass='table';
				elseif ErrorWhenFail
					error('FormatSpecification:TypeException','：类型错误，不是表');
				else
					Report=false;
					return
				end
			case 'timetable'
				if istimetable(Object)
					ElementClass='table';
					Object=timetable2table(Object);
				elseif ErrorWhenFail
					error('FormatSpecification:TypeException','：类型错误，不是时间表');
				else
					Report=false;
					return
				end
			case 'cell'
				if iscell(Object)
					ElementClass='cell';
				elseif ErrorWhenFail
					error('FormatSpecification:TypeException','：类型错误，不是元胞');
				else
					Report=false;
					return
				end
			case 'scalar'
				if ~IsScalar
					if ErrorWhenFail
						error('FormatSpecification:SizeException','：尺寸错误，不是标量');
					else
						Report=false;
						return
					end
				end
			case 'column'
				if ~iscolumn(Object)
					if ErrorWhenFail
						error('FormatSpecification:SizeException','：尺寸错误，不是列向量');
					else
						Report=false;
						return
					end
				end
			case 'row'
				if ~isrow(Object)
					if ErrorWhenFail
						error('FormatSpecification:SizeException','：尺寸错误，不是行向量');
					else
						Report=false;
						return
					end
				end
			case '2d'
				if ~ismatrix(Object)
					if ErrorWhenFail
						error('FormatSpecification:SizeException','：尺寸错误，多于2维');
					else
						Report=false;
						return
					end
				end
			case '3d'
				if ndims(Object)>3
					if ErrorWhenFail
						error('FormatSpecification:SizeException','：尺寸错误，多于3维');
					else
						Report=false;
						return
					end
				end
			otherwise
				if startsWith(Type,'size=')
					SSizes=split(Type(6:end),',');
					NDims=numel(SSizes);
					OSizes=size(Object,1:NDims);
					NumericLogical=SSizes~=":";
					if any(str2double(SSizes(NumericLogical))~=OSizes(NumericLogical))
						if ErrorWhenFail
							error('FormatSpecification:SizeException','：尺寸错误');
						else
							Report=false;
							return
						end
					end
				else
					ElementClass=Type;
				end
		end
	end
	switch ElementClass
		case 'struct'
			if isfield(Specification,'fields')
				SFields=Specification.fields;
				if IsScalar
					Report=ValidateStructLike(SFields,Object,ErrorWhenFail,@(V)error('FormatSpecification:FieldNotExist','.%s：字段不存在',V));
				else
					AllSuccess=true;
					Report=cell(size(Object));
					for S=1:numel(Object)
						SubReport=ValidateStructLike(SFields,Object(S),ErrorWhenFail,@(V)error('FormatSpecification:FieldNotExist','(%u).%s：字段不存在',S,V));
						if ~islogical(SubReport)
							AllSuccess=false;
						end
						Report{S}=SubReport;
					end
					if AllSuccess
						Report=true;
					end
				end
			else
				Report=true;
			end
		case 'matfile'
			if isfield(Specification,'filename')
				[~,OFilename,Extension]=fileparts(Object);
				OFilename=fullfile(OFilename,Extension);
				if isempty(regexp(OFilename,Specification.filename,'once'))
					if ErrorWhenFail
						error('FormatSpecification:FilenameException','：文件名格式错误');
					else
						Report=false;
						return
					end
				end
			end
			if isfield(Specification,'variables')
				SFields=Specification.fields;
				if IsScalar
					Report=ValidateStructLike(SFields,load(Object),ErrorWhenFail,@(V)error('FormatSpecification:VariableNotExist','.%s：变量不存在',V));
				else
					Object=arrayfun(@load,Object,UniformOutput=false);
					AllSuccess=true;
					Report=cell(size(Object));
					for S=1:numel(Object)
						SubReport=ValidateStructLike(SFields,Object{S},ErrorWhenFail,@(V)error('FormatSpecification:VariableNotExist','(%u).%s：变量不存在',S,V));
						if ~islogical(SubReport)
							AllSuccess=false;
						end
						Report{S}=SubReport;
					end
					if AllSuccess
						Report=true;
					end
				end
			else
				Report=true;
			end
		case 'table'
			if isfield(Specification,'columns')
				OColumns=Object.Properties.VariableNames;
				SColumns=Specification.columns;
				AllSuccess=true;
				NoColumns=numel(SColumns);
				for C=1:NoColumns
					SColumn=SColumns{C};
					ColName=SColumn.name;
					if ismember(ColName,OColumns)
						OColumn=Object.(ColName);
						if iscell(OColumn)
							NoRows=height(OColumn);
							ColumnReport=cell(NoRows,1);
							ColumnSuccess=true;
							for R=1:NoRows
								try
									SubReport=RecursiveValidate(OColumn(R),SColumn,ErrorWhenFail);
								catch ME
									error(ME.identifier,'.%s(%u)%s',ColName,R,ME.message);
								end
								if ~isequal(SubReport,true)
									ColumnSuccess=false;
								end
								ColumnReport{R}=SubReport;
							end
							if ColumnSuccess
								ColumnReport=true;
							else
								AllSuccess=false;
							end
							Report.(ColName)=ColumnReport;
						else
							try
								SubReport=RecursiveValidate(OColumn(1),SColumn,ErrorWhenFail);
							catch ME
								error(ME.identifier,['.' ColName ME.message]);
							end
							if ~isequal(SubReport,true)
								AllSuccess=false;
							end
							Report.(ColName)=SubReport;
						end
					elseif ErrorWhenFail
						error('FormatSpecification:ColumnException','.%s：列名不存在',ColName);
					else
						Report.(ColName)=missing;
						AllSuccess=false;
					end
				end
				if AllSuccess
					Report=true;
				end
			else
				Report=true;
			end
		case 'cell'
			if isfield(Specification,'content')
				SContent=Specification.content;
				Report=cell(size(Object));
				AllSuccess=true;
				for C=1:numel(Object)
					try
						SubReport=RecursiveValidate(Object{C},SContent,ErrorWhenFail);
					catch ME
						error(ME.identifier,'{%u}%s',C,ME.message);
					end
					if ~isequal(SubReport,true)
						AllSuccess=false;
					end
					Report{C}=SubReport;
				end
				if AllSuccess
					Report=true;
				end
			else
				Report=true;
			end
		otherwise
			if ismissing(ElementClass)
				Report=true;
			else
				Report=isa(Object,ElementClass);
				if ~Report&&ErrorWhenFail
					error('FormatSpecification:TypeException','：类型错误，不是%s',ElementClass);
				end
			end
	end
else
	Report=true;
end